#!/usr/bin/python
# -*- coding: UTF-8 -*-

import dbus
import dbus.glib
import gobject

class TVWatcher: 

   def __init__(self):
      bus = dbus.SessionBus()
      obj = bus.get_object('br.org.cinlug', '/Television')

      obj.connect_to_signal('TelevisionOff', self.tv_is_off,
                            dbus_interface='br.org.cinlug.Television')

   def tv_is_off(self, message):
      print '- TV Off -'
      print 'msg: ', message

if __name__ == '__main__':
   tvw = TVWatcher()

   mainloop = gobject.MainLoop()
   mainloop.run()

